<template>
    <div>
        <el-card class="box-card" style="margin:20px;min-width:800px">
            <div slot="header" class="clearfix">
                <span style="line-height:36px"><b>医生列表</b></span>
                <!-- <el-button style="float:right;background-color:rgb(118,149,255);border-color:rgb(118,149,255)" type="primary" @click="addNewArticle"></el-button> -->
            </div>
            <div>
                <el-table :data="doctorStore" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;">
                    <el-table-column prop="Name" label="姓名" min-width="80" align="left"></el-table-column>
                    <el-table-column prop="Gender" label="性别" min-width="80" align="left" :formatter="formateGender"></el-table-column >
                    <el-table-column prop="HospitalName" label="所属医院" min-width="100" align="left"></el-table-column>
                    <el-table-column prop="JobTitle" label="职称" min-width="100" align="left"></el-table-column>
                    <el-table-column prop="GoodATCancer" label="擅长癌种" min-width="100" align="left"></el-table-column>
                    <el-table-column prop="CreateTime" label="创建时间" min-width="140" align="left"></el-table-column>
                    <el-table-column prop="Approval" label="认证状态" min-width="100" align="left" :formatter="formatApproval"></el-table-column>
                    <el-table-column  label="操作" min-width="100" align="center" fixed="right" >
                        <template scope="scope">
                            <el-button size="small" @click="handleDetail(scope.$index,scope.row)">详情</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-col :span="24" class="toolbar" style="background-color:white">
			        <el-pagination layout="total,prev, pager, next" background @current-change="getDoctorList" :page-size="PageSize" :total="total" style="float:right;background-color:#f2f2f2;border:1px solid rgb(220,223,230)">
			        </el-pagination>  
		        </el-col>
                <el-dialog title="医生详情" width="80%" :visible.sync="ifShowAdd"  @close="getDoctorList"><examine :doctor-info="doctorInfo"  @getNew="updateDoctorList"></examine></el-dialog>
            </div>
        </el-card>
    </div>    
</template>
<script>
import {getDoctorList} from '../../api/api';
import examine from './examine'
export default {
    data(){
        return{
            page:1,
            total: 0,
            PageSize:5,
            CurrentPage:"",
            doctorStore:"",
            form:"",
            ifOpen:0,
            ifShowAdd:false,
            doctorInfo:''
        }
    },
    methods:{
        getAllDoctorList:function(){
            this.doctorInfo="";
            let param={
                Type:1,
                Name:this.form.Name,
                PageSize:this.PageSize,
                CurrentPage:this.page,
            }
            getDoctorList(param).then(res=>{
                if(res.data.IsSuccess){
                    this.doctorStore=res.data.Result;
                    this.total=res.data.PageCount;
                }
            })
        },
        formateGender:function(row,column){
            return row.Gender == 0 ? '男' : row.Gender == 1 ? '女' : '';
        },
        updateDoctorList:function(){
            this.ifShowAdd=false;
            this.getAllDoctorList();
        },
        handleDetail:function(index,row){
            this.doctorInfo=row;
            this.ifShowAdd=true;
        },
        formatApproval: function (row, column) {
				return row.ApprovalStatus == 0 ? '未认证' : row.ApprovalStatus  == 1 ? '待认证' : row.ApprovalStatus  == 2 ? '已通过':'已拒绝' ;
        },
    },
    components:{
        examine
    },
    mounted(){
        this.getAllDoctorList();
    }
}
</script>
<style lang="scss" scoped>

</style>


